<template>
  <div >
    <a-form-model class="fromModels" ref="privacyagreementModel" layout="vertical"  labelAlign="right"
    :labelCol="{span: 8}" :wrapperCol="{span: 16}">
        <a-form-model-item label="中介权限" >
          <a-radio-group v-model="zjtgsystemFroms.intermediary_support">
            <a-radio :value="1"> 支持 </a-radio>
            <a-radio :value="0"> 不支持 </a-radio>
          </a-radio-group>
        </a-form-model-item>
        <a-form-model-item label="托管权限" >
          <a-radio-group v-model="zjtgsystemFroms.trusteeship_support">
            <a-radio :value="1"> 支持 </a-radio>
            <a-radio :value="0"> 不支持 </a-radio>
          </a-radio-group>
        </a-form-model-item>
        <a-form-model-item label="默认展示" >
          <a-radio-group v-model="zjtgsystemFroms.default_show_type">
            <a-radio :value="0"> 暂无 </a-radio>
            <a-radio :disabled="zjtgsystemFroms.intermediary_support!=1" :value="1"> 中介 </a-radio>
            <a-radio :disabled="zjtgsystemFroms.trusteeship_support!=1" :value="2"> 托管 </a-radio>
          </a-radio-group>
        </a-form-model-item>
        <a-form-model-item  :wrapper-col="{ span: 21, offset:8 }">
          <a-button type="primary" @click="saveInfo">保存</a-button>
          <a-button style="margin: 0 10px;"  @click="resterInfor">重置</a-button>
          <a-button type="primary"  @click="saveInfo">同步品牌</a-button>
        </a-form-model-item>
    </a-form-model>
  </div>
</template>

<script>
import { getConfigTrusteeshipIntermediary,writeConfigTrusteeshipIntermediary } from '@/api/system.js'
export default {
  name: '',
  
  data() {
      return {
        zjtgsystemFroms:{
          default_show_type:0,
          intermediary_support:0,
          trusteeship_support:0,
        }
      }
  },
  created(){
    this.getDataInfor()
  },
  methods:{
    resterInfor(){
      this.zjtgsystemFroms={
          default_show_type:'',
          intermediary_support:'',
          trusteeship_support:'',
        }
    },
    saveInfo(){
      writeConfigTrusteeshipIntermediary({
        brand_id: process.env.VUE_APP_BRAND_ID,...this.zjtgsystemFroms}).then(res=>{
        this.$message.success("操作成功");
      })
    },

    getDataInfor(){
      getConfigTrusteeshipIntermediary({
        brand_id: process.env.VUE_APP_BRAND_ID,}).then(res=>{
        this.zjtgsystemFroms=res.data
      })
    }
  }
}
</script>

<style lang="less" scoped>
/deep/ .ant-form-vertical .ant-form-item-label{
  text-align: right;
  padding-right: 10px;
}
/deep/ .ant-form-vertical .ant-form-item-label::after{
  content: '：';
}
</style>
